package com.jackstraw.jack_base.mq.rocketmq.bean;

import com.jackstraw.jack_base.mq.common.entity.MQTemplateS;
import lombok.Data;
import org.apache.rocketmq.client.consumer.DefaultLitePullConsumer;
import org.apache.rocketmq.client.producer.DefaultMQProducer;
import org.apache.rocketmq.spring.core.RocketMQTemplate;

import java.util.HashMap;
import java.util.Map;

@Data
public class RocketMQTemplateS extends MQTemplateS<RocketMqEntity,RocketMqProducer,RocketMqConsumer,RocketMQTemplateS> {

    /**
     * 默认的Template
     */
    private RocketMQTemplate rocketMQTemplate;

    /**
     * 默认的Producer
     */
    private DefaultMQProducer defaultMQProducer;

    /**
     * 默认的Consumer
     */
    private DefaultLitePullConsumer defaultLitePullConsumer;

    /**
     * 其他的Template
     * <p>
     * 当配置文件中otherConsumerS存在是，该项存在
     */
    private Map<String, RocketMQTemplate> rocketMQTemplateMap = new HashMap<>();

    /**
     * 其他的Consumer
     * <p>
     * 当配置文件中otherConsumerS存在是，该项存在
     */
    private Map<String, DefaultLitePullConsumer> defaultLitePullConsumerMap = new HashMap<>();

    @Override
    public RocketMQTemplate get() {
        return this.getRocketMQTemplate();
    }

    @Override
    public RocketMQTemplate get(String key) {
        return this.rocketMQTemplateMap.get(key);
    }
}
